//### This file created by BYACC 1.8(/Java extension  1.15)
//### Java capabilities added 7 Jan 97, Bob Jamison
//### Updated : 27 Nov 97  -- Bob Jamison, Joe Nieten
//###           01 Jan 98  -- Bob Jamison -- fixed generic semantic constructor
//###           01 Jun 99  -- Bob Jamison -- added Runnable support
//###           06 Aug 00  -- Bob Jamison -- made state variables class-global
//###           03 Jan 01  -- Bob Jamison -- improved flags, tracing
//###           16 May 01  -- Bob Jamison -- added custom stack sizing
//###           04 Mar 02  -- Yuval Oren  -- improved java performance, added options
//###           14 Mar 02  -- Tomas Hurka -- -d support, static initializer workaround
//### Please send bug reports to tom@hukatronic.cz
//### static char yysccsid[] = "@(#)yaccpar	1.8 (Berkeley) 01/20/90";






//#line 2 "matlabMe.y"
  package interpreter;
  import java.io.*;
  import matrix.*;
  import variables.*;
//#line 22 "Parser.java"




public class Parser
{

boolean yydebug;        //do I want debug output?
int yynerrs;            //number of errors so far
int yyerrflag;          //was there an error?
int yychar;             //the current working character

//########## MESSAGES ##########
//###############################################################
// method: debug
//###############################################################
void debug(String msg)
{
  if (yydebug)
    System.out.println(msg);
}

//########## STATE STACK ##########
final static int YYSTACKSIZE = 500;  //maximum stack size
int statestk[] = new int[YYSTACKSIZE]; //state stack
int stateptr;
int stateptrmax;                     //highest index of stackptr
int statemax;                        //state when highest index reached
//###############################################################
// methods: state stack push,pop,drop,peek
//###############################################################
final void state_push(int state)
{
  try {
		stateptr++;
		statestk[stateptr]=state;
	 }
	 catch (ArrayIndexOutOfBoundsException e) {
     int oldsize = statestk.length;
     int newsize = oldsize * 2;
     int[] newstack = new int[newsize];
     System.arraycopy(statestk,0,newstack,0,oldsize);
     statestk = newstack;
     statestk[stateptr]=state;
  }
}
final int state_pop()
{
  return statestk[stateptr--];
}
final void state_drop(int cnt)
{
  stateptr -= cnt; 
}
final int state_peek(int relative)
{
  return statestk[stateptr-relative];
}
//###############################################################
// method: init_stacks : allocate and prepare stacks
//###############################################################
final boolean init_stacks()
{
  stateptr = -1;
  val_init();
  return true;
}
//###############################################################
// method: dump_stacks : show n levels of the stacks
//###############################################################
void dump_stacks(int count)
{
int i;
  System.out.println("=index==state====value=     s:"+stateptr+"  v:"+valptr);
  for (i=0;i<count;i++)
    System.out.println(" "+i+"    "+statestk[i]+"      "+valstk[i]);
  System.out.println("======================");
}


//########## SEMANTIC VALUES ##########
//public class ParserVal is defined in ParserVal.java


String   yytext;//user variable to return contextual strings
ParserVal yyval; //used to return semantic vals from action routines
ParserVal yylval;//the 'lval' (result) I got from yylex()
ParserVal valstk[];
int valptr;
//###############################################################
// methods: value stack push,pop,drop,peek.
//###############################################################
void val_init()
{
  valstk=new ParserVal[YYSTACKSIZE];
  yyval=new ParserVal();
  yylval=new ParserVal();
  valptr=-1;
}
void val_push(ParserVal val)
{
  if (valptr>=YYSTACKSIZE)
    return;
  valstk[++valptr]=val;
}
ParserVal val_pop()
{
  if (valptr<0)
    return new ParserVal();
  return valstk[valptr--];
}
void val_drop(int cnt)
{
int ptr;
  ptr=valptr-cnt;
  if (ptr<0)
    return;
  valptr = ptr;
}
ParserVal val_peek(int relative)
{
int ptr;
  ptr=valptr-relative;
  if (ptr<0)
    return new ParserVal();
  return valstk[ptr];
}
final ParserVal dup_yyval(ParserVal val)
{
  ParserVal dup = new ParserVal();
  dup.ival = val.ival;
  dup.dval = val.dval;
  dup.sval = val.sval;
  dup.obj = val.obj;
  return dup;
}
//#### end semantic value section ####
public final static short NUMBER=257;
public final static short ID=258;
public final static short COLON=259;
public final static short SEMICOLON=260;
public final static short LSBRACKET=261;
public final static short RSBRACKET=262;
public final static short DOTADD=263;
public final static short DOTMINUS=264;
public final static short DOTMULT=265;
public final static short DOTDIV=266;
public final static short DOTEXP=267;
public final static short NL=268;
public final static short NEG=269;
public final static short YYERRCODE=256;
final static short yylhs[] = {                           -1,
    0,    0,    4,    4,    4,    4,    4,    4,    4,    4,
    4,    4,    4,    4,    2,    2,    2,    2,    2,    2,
    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
    2,    5,    1,    6,    6,    7,    7,    7,    7,    3,
    3,    3,    3,    3,    3,    3,    3,    3,
};
final static short yylen[] = {                            2,
    0,    2,    1,    2,    3,    3,    2,    3,    2,    2,
    5,    4,    4,    5,    1,    1,    3,    3,    2,    3,
    3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
    3,    3,    3,    3,    3,    3,    3,    3,    3,    3,
    3,    0,    4,    1,    3,    3,    5,    1,    2,    1,
    3,    3,    2,    2,    3,    3,    3,    3,
};
final static short yydefred[] = {                         1,
    0,   50,    0,    0,    3,    0,    0,    0,    0,   15,
    0,    0,    2,    0,    0,   10,    0,    4,    0,   54,
   53,   16,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    7,    0,    0,    0,    0,    0,   19,    0,
    0,    0,    0,    0,    9,    0,    0,    0,    0,    0,
    0,    5,    0,    0,    0,    0,    0,    0,    0,   17,
   58,   18,    6,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    8,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,    0,   12,    0,   13,    0,    0,
    0,    0,    0,    0,   43,    0,   11,   14,    0,    0,
    0,    0,
};
final static short yydgoto[] = {                          1,
   10,   11,   26,   13,   14,   93,   94,
};
final static short yysindex[] = {                         0,
  429,    0,   46, -258,    0,    1,    1,  597,  597,    0,
   92,  428,    0, -240, -246,    0,  597,    0,    1,    0,
    0,    0,  404,  533,  411,  539, -245,    1,    1,    1,
    1,    1,    0,  597,  597,  597,  597,    1,    0, -239,
  597,  597,  597,  597,    0,  597,  597,  597,  597,    1,
    1,    0,  101,  525,  727,    1,    1,    1,    1,    0,
    0,    0,    0,   11,   11,  -63,  -63,  107,  336,   85,
  336,   85,   64,  -63,   64,  -63,  -63,    0,  336,  336,
   64,   64,  336,   85,  336,   85,   64,  -63,   64,  -63,
  -63,  610, -255,    1, -235,    0, -234,    0,   11,   11,
  -63,  -63,    1,    1,    0,  107,    0,    0,  617,    1,
    1,  107,
};
final static short yyrindex[] = {                         0,
 -226,    0,  418,    0,    0,    0,    0, -226, -226,    0,
    0,    0,    0,    0,    0,    0, -226,    0,    0,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0, -226, -226, -226, -226,    0,    0,    0,
 -226, -226, -226, -226,    0, -226, -226, -226, -226,    0,
    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
    0,    0,    0,  122,  131,   18,   27,  143,  297,  155,
  371,  165,  435,   36,  442,   45,   57,    0,  480,  486,
  449,  459,  493,  174,  499,  331,  466,   69,  473,   81,
  -39,  286,    0, -251,    0,    0,    0,    0,   -3,    9,
  -27,  -15,    0,    0,    0,  290,    0,    0,  352, -243,
    0,  364,
};
final static short yygindex[] = {                         0,
    0,  836,  800,    0,    0,    0,  -65,
};
final static int YYTABLESIZE=911;
static short yytable[];
static { yytable();}
static void yytable(){
yytable = new short[]{                         57,
   57,   57,   57,   57,  104,   57,  105,   57,   44,   18,
   44,   55,   55,   55,   55,   55,   45,   55,   45,   55,
   51,   52,   63,   56,   56,   56,   56,   56,   78,   56,
   50,   56,  107,  108,   42,   52,   52,   52,  110,   52,
   19,   52,    0,    7,    0,    6,    0,   51,   51,   51,
    0,   51,   58,   51,    0,    0,   33,   59,   33,   33,
   33,    0,   33,    0,   33,   38,    0,   38,   38,   38,
    0,   38,    0,   38,   35,    0,   35,   35,   35,    0,
   35,    0,   35,   40,   57,   40,   40,   40,    0,   40,
    0,   40,    0,    0,    0,   20,   55,   20,   20,   20,
    0,   20,   39,   20,   50,    0,   17,   55,   56,   55,
   55,   55,    0,   55,    0,   55,    0,    0,    0,   56,
   52,   56,   56,   56,    0,   56,   48,   56,    0,    0,
   39,   49,   51,   36,   35,    0,   34,    0,   37,   39,
    0,   33,   36,   35,    0,   34,    0,   37,   58,   57,
   38,   56,    0,   59,    0,    0,    0,   38,    0,   35,
   23,    0,   23,    0,   23,    0,   23,    0,   40,   28,
    0,   28,    0,   28,    0,   28,    0,    0,   50,    0,
   20,   21,    0,   21,    0,   38,    0,    0,    0,    0,
    0,    0,   55,   30,   38,   30,    0,   30,    0,   30,
   50,    0,    0,   25,   56,   25,    0,   25,    0,   25,
    0,    0,   52,    0,   52,    0,   52,   57,   52,   57,
   57,    0,   57,   57,   57,   57,   57,   57,   57,   55,
    0,   55,   55,    0,   55,   55,   55,   55,   55,   55,
   55,   56,    0,   56,   56,   23,   56,   56,   56,   56,
   56,   56,   56,   52,   28,   52,   52,    2,   52,   52,
   52,   52,   52,   52,   52,   51,   21,   51,   51,    0,
   51,   51,   51,   51,   51,   51,   51,   33,   30,    0,
   33,   33,   33,   33,   33,   33,   38,    0,   25,   38,
   38,   38,   38,   38,   38,   35,    0,   52,   35,   35,
   35,   35,   35,   35,   40,   15,    0,   40,   40,   40,
   40,   40,   40,   16,    0,    0,   20,    0,    0,   20,
   20,   20,   20,   20,   20,   48,    0,    0,   55,   49,
   32,   55,   55,   55,   55,   55,   55,   27,    0,   27,
   56,   27,    0,   56,   56,   56,   56,   56,   56,   43,
   44,   27,    0,    0,   28,   29,   30,   31,   32,   33,
   95,    0,    0,   28,   29,   30,   31,   32,   96,   51,
    0,   51,    0,   51,   39,   51,    0,   36,    0,    0,
    0,   23,   37,    0,   23,   23,   23,   23,   23,   23,
   28,   46,    0,   28,   28,   28,   28,   28,   28,    0,
    0,    0,   21,   47,    0,   21,   21,   21,   21,   21,
   21,   22,    0,   22,   30,   22,    0,   30,   30,    0,
   27,   30,   30,    0,   25,    0,    0,   25,   25,   38,
    0,   25,   25,   52,    0,    0,   52,   52,    0,    0,
   52,   52,   39,    0,   60,   36,   35,    0,   34,   39,
   37,    0,   36,   35,   51,   34,   16,   37,    0,   16,
   16,    0,   16,    0,   16,    0,    0,    0,    8,   48,
   47,    7,   46,    6,   49,   32,   32,   32,    0,   32,
    0,   32,   37,   37,   37,    0,   37,    0,   37,   34,
   34,   34,    0,   34,   22,   34,    0,   38,    0,   39,
   39,   39,    0,   39,   38,   39,   36,   36,   36,    0,
   36,   16,   36,   41,   41,   41,    0,   41,    0,   41,
   24,   50,   24,    0,   24,    0,   29,    0,   29,    0,
   29,    0,    0,   31,   62,   31,    0,   31,    0,   26,
    0,   26,   48,   26,    0,   48,   49,   48,    0,   49,
    0,   49,    9,    0,    0,    0,   27,    0,   32,   27,
   27,    0,    0,    0,   27,   37,   48,   47,    0,   46,
    0,   49,   34,   61,   48,   47,    0,   46,    0,   49,
   48,   47,   39,   46,    0,   49,    0,    0,    0,   36,
   51,    0,    0,   51,   51,    0,   41,   51,   51,    0,
   30,   31,   32,   24,    0,    0,    0,    0,   46,   29,
    0,   46,    0,   46,    0,    0,   31,    0,   50,    0,
   47,    0,   26,   47,    0,   47,   50,    0,    0,    0,
   22,    0,   50,   22,   22,    0,    8,    0,   22,    7,
    0,    6,    0,    0,    0,    0,    0,    0,    0,    0,
    0,   58,   57,    0,   56,    0,   59,    0,   58,   57,
    0,   56,    0,   59,    0,    0,   28,   29,   30,   31,
   32,    0,    0,   28,   29,   30,   31,   32,    0,    0,
   16,   16,   16,   16,   16,    2,    3,   40,    4,    0,
   41,   42,   43,   44,   32,   45,    5,   32,   32,   32,
   32,   37,   32,   50,   37,   37,   37,   37,   34,   37,
   50,   34,   34,   34,   34,    0,   34,    0,   39,    0,
    9,   39,   39,   39,   39,   36,   39,    0,   36,   36,
   36,   36,   41,   36,    0,   41,   41,   41,   41,   24,
   41,    0,   24,   24,    0,   29,    0,   24,   29,   29,
    0,    0,   31,   29,    0,   31,   31,    0,   26,    0,
   31,   26,   26,    0,    0,    0,   26,   61,   58,   57,
    0,   56,    0,   59,    0,    0,    0,    0,    0,    0,
    0,    0,    0,    0,   97,    0,    0,   41,   42,   43,
   44,    0,   98,    0,    0,   41,   42,   43,   44,    0,
   12,   41,   42,   43,   44,   20,   21,   24,    0,    0,
    0,    0,    0,    0,    0,    0,   54,    0,   55,    0,
   50,    0,    0,    0,    0,    0,    0,   64,   65,   66,
   67,   68,    0,   70,   72,   74,   76,   77,    0,    0,
    0,    0,    0,   23,   25,   84,   86,   88,   90,   91,
   92,    0,   53,    2,   22,   99,  100,  101,  102,    0,
    0,    0,    0,    0,    0,    0,    0,    0,  103,   69,
   71,   73,   75,    0,    0,  111,   79,   80,   81,   82,
    0,   83,   85,   87,   89,    0,    0,    0,    0,    0,
    0,    0,    0,  106,    0,    0,    0,    0,    0,    0,
    0,    0,  109,   92,    0,    0,    0,    0,    0,  106,
  112,
};
}
static short yycheck[];
static { yycheck(); }
static void yycheck() {
yycheck = new short[] {                         39,
   40,   41,   42,   43,  260,   45,  262,   47,  260,  268,
  262,   39,   40,   41,   42,   43,  260,   45,  262,   47,
  261,  268,  268,   39,   40,   41,   42,   43,  268,   45,
   94,   47,  268,  268,  261,   39,   40,   41,  104,   43,
   40,   45,   -1,   43,   -1,   45,   -1,   39,   40,   41,
   -1,   43,   42,   45,   -1,   -1,   39,   47,   41,   42,
   43,   -1,   45,   -1,   47,   39,   -1,   41,   42,   43,
   -1,   45,   -1,   47,   39,   -1,   41,   42,   43,   -1,
   45,   -1,   47,   39,  124,   41,   42,   43,   -1,   45,
   -1,   47,   -1,   -1,   -1,   39,  124,   41,   42,   43,
   -1,   45,   39,   47,   94,   -1,   61,   39,  124,   41,
   42,   43,   -1,   45,   -1,   47,   -1,   -1,   -1,   39,
  124,   41,   42,   43,   -1,   45,   42,   47,   -1,   -1,
   39,   47,  124,   42,   43,   -1,   45,   -1,   47,   39,
   -1,  124,   42,   43,   -1,   45,   -1,   47,   42,   43,
  124,   45,   -1,   47,   -1,   -1,   -1,   94,   -1,  124,
   39,   -1,   41,   -1,   43,   -1,   45,   -1,  124,   39,
   -1,   41,   -1,   43,   -1,   45,   -1,   -1,   94,   -1,
  124,   39,   -1,   41,   -1,   94,   -1,   -1,   -1,   -1,
   -1,   -1,  124,   39,   94,   41,   -1,   43,   -1,   45,
   94,   -1,   -1,   39,  124,   41,   -1,   43,   -1,   45,
   -1,   -1,   39,   -1,   41,   -1,   43,  257,   45,  259,
  260,   -1,  262,  263,  264,  265,  266,  267,  268,  257,
   -1,  259,  260,   -1,  262,  263,  264,  265,  266,  267,
  268,  257,   -1,  259,  260,  124,  262,  263,  264,  265,
  266,  267,  268,  257,  124,  259,  260,  257,  262,  263,
  264,  265,  266,  267,  268,  257,  124,  259,  260,   -1,
  262,  263,  264,  265,  266,  267,  268,  260,  124,   -1,
  263,  264,  265,  266,  267,  268,  260,   -1,  124,  263,
  264,  265,  266,  267,  268,  260,   -1,  124,  263,  264,
  265,  266,  267,  268,  260,  260,   -1,  263,  264,  265,
  266,  267,  268,  268,   -1,   -1,  260,   -1,   -1,  263,
  264,  265,  266,  267,  268,   40,   -1,   -1,  260,   40,
  267,  263,  264,  265,  266,  267,  268,   41,   -1,   43,
  260,   45,   -1,  263,  264,  265,  266,  267,  268,  265,
  266,  260,   -1,   -1,  263,  264,  265,  266,  267,  268,
  260,   -1,   -1,  263,  264,  265,  266,  267,  268,   39,
   -1,   41,   -1,   43,   39,   45,   -1,   42,   -1,   -1,
   -1,  260,   47,   -1,  263,  264,  265,  266,  267,  268,
  260,   40,   -1,  263,  264,  265,  266,  267,  268,   -1,
   -1,   -1,  260,   40,   -1,  263,  264,  265,  266,  267,
  268,   41,   -1,   43,  260,   45,   -1,  263,  264,   -1,
  124,  267,  268,   -1,  260,   -1,   -1,  263,  264,   94,
   -1,  267,  268,  260,   -1,   -1,  263,  264,   -1,   -1,
  267,  268,   39,   -1,   41,   42,   43,   -1,   45,   39,
   47,   -1,   42,   43,  124,   45,   39,   47,   -1,   42,
   43,   -1,   45,   -1,   47,   -1,   -1,   -1,   40,   42,
   43,   43,   45,   45,   47,   41,   42,   43,   -1,   45,
   -1,   47,   41,   42,   43,   -1,   45,   -1,   47,   41,
   42,   43,   -1,   45,  124,   47,   -1,   94,   -1,   41,
   42,   43,   -1,   45,   94,   47,   41,   42,   43,   -1,
   45,   94,   47,   41,   42,   43,   -1,   45,   -1,   47,
   41,   94,   43,   -1,   45,   -1,   41,   -1,   43,   -1,
   45,   -1,   -1,   41,  124,   43,   -1,   45,   -1,   41,
   -1,   43,  257,   45,   -1,  260,  257,  262,   -1,  260,
   -1,  262,  124,   -1,   -1,   -1,  260,   -1,  124,  263,
  264,   -1,   -1,   -1,  268,  124,   42,   43,   -1,   45,
   -1,   47,  124,   41,   42,   43,   -1,   45,   -1,   47,
   42,   43,  124,   45,   -1,   47,   -1,   -1,   -1,  124,
  260,   -1,   -1,  263,  264,   -1,  124,  267,  268,   -1,
  265,  266,  267,  124,   -1,   -1,   -1,   -1,  257,  124,
   -1,  260,   -1,  262,   -1,   -1,  124,   -1,   94,   -1,
  257,   -1,  124,  260,   -1,  262,   94,   -1,   -1,   -1,
  260,   -1,   94,  263,  264,   -1,   40,   -1,  268,   43,
   -1,   45,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   42,   43,   -1,   45,   -1,   47,   -1,   42,   43,
   -1,   45,   -1,   47,   -1,   -1,  263,  264,  265,  266,
  267,   -1,   -1,  263,  264,  265,  266,  267,   -1,   -1,
  263,  264,  265,  266,  267,  257,  258,  260,  260,   -1,
  263,  264,  265,  266,  260,  268,  268,  263,  264,  265,
  266,  260,  268,   94,  263,  264,  265,  266,  260,  268,
   94,  263,  264,  265,  266,   -1,  268,   -1,  260,   -1,
  124,  263,  264,  265,  266,  260,  268,   -1,  263,  264,
  265,  266,  260,  268,   -1,  263,  264,  265,  266,  260,
  268,   -1,  263,  264,   -1,  260,   -1,  268,  263,  264,
   -1,   -1,  260,  268,   -1,  263,  264,   -1,  260,   -1,
  268,  263,  264,   -1,   -1,   -1,  268,   41,   42,   43,
   -1,   45,   -1,   47,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   -1,  260,   -1,   -1,  263,  264,  265,
  266,   -1,  268,   -1,   -1,  263,  264,  265,  266,   -1,
    1,  263,  264,  265,  266,    6,    7,    8,   -1,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   17,   -1,   19,   -1,
   94,   -1,   -1,   -1,   -1,   -1,   -1,   28,   29,   30,
   31,   32,   -1,   34,   35,   36,   37,   38,   -1,   -1,
   -1,   -1,   -1,    8,    9,   46,   47,   48,   49,   50,
   51,   -1,   17,  257,  258,   56,   57,   58,   59,   -1,
   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  259,   34,
   35,   36,   37,   -1,   -1,  259,   41,   42,   43,   44,
   -1,   46,   47,   48,   49,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,   -1,   94,   -1,   -1,   -1,   -1,   -1,   -1,
   -1,   -1,  103,  104,   -1,   -1,   -1,   -1,   -1,  110,
  111,
};
}
final static short YYFINAL=1;
final static short YYMAXTOKEN=269;
final static String yyname[] = {
"end-of-file",null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,"'\\''","'('","')'","'*'","'+'",
null,"'-'",null,"'/'",null,null,null,null,null,null,null,null,null,null,null,
null,null,"'='",null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,"'^'",null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,"'|'",null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,
null,null,null,null,null,null,null,null,null,"NUMBER","ID","COLON","SEMICOLON",
"LSBRACKET","RSBRACKET","DOTADD","DOTMINUS","DOTMULT","DOTDIV","DOTEXP","NL",
"NEG",
};
final static String yyrule[] = {
"$accept : input",
"input :",
"input : input line",
"line : NL",
"line : SEMICOLON NL",
"line : ID SEMICOLON NL",
"line : matrixExp SEMICOLON NL",
"line : matrixExp NL",
"line : numExp SEMICOLON NL",
"line : numExp NL",
"line : ID NL",
"line : ID '=' matrixExp SEMICOLON NL",
"line : ID '=' matrixExp NL",
"line : ID '=' numExp NL",
"line : ID '=' numExp SEMICOLON NL",
"matrixExp : matrix",
"matrixExp : ID",
"matrixExp : '(' matrixExp ')'",
"matrixExp : '|' matrixExp '|'",
"matrixExp : matrixExp '\\''",
"matrixExp : matrixExp '^' numExp",
"matrixExp : matrixExp DOTEXP numExp",
"matrixExp : matrixExp '+' matrixExp",
"matrixExp : matrixExp DOTADD numExp",
"matrixExp : numExp DOTADD matrixExp",
"matrixExp : matrixExp '+' numExp",
"matrixExp : numExp '+' matrixExp",
"matrixExp : matrixExp '-' matrixExp",
"matrixExp : matrixExp DOTMINUS numExp",
"matrixExp : numExp DOTMINUS matrixExp",
"matrixExp : matrixExp '-' numExp",
"matrixExp : numExp '-' matrixExp",
"matrixExp : matrixExp '*' matrixExp",
"matrixExp : matrixExp DOTMULT numExp",
"matrixExp : numExp DOTMULT matrixExp",
"matrixExp : matrixExp '*' numExp",
"matrixExp : numExp '*' matrixExp",
"matrixExp : matrixExp '/' matrixExp",
"matrixExp : matrixExp DOTDIV numExp",
"matrixExp : numExp DOTDIV matrixExp",
"matrixExp : matrixExp '/' numExp",
"matrixExp : numExp '/' matrixExp",
"$$1 :",
"matrix : $$1 LSBRACKET rows RSBRACKET",
"rows : row",
"rows : rows SEMICOLON row",
"row : numExp COLON numExp",
"row : numExp COLON numExp COLON numExp",
"row : numExp",
"row : row numExp",
"numExp : NUMBER",
"numExp : numExp '+' numExp",
"numExp : numExp '-' numExp",
"numExp : '+' numExp",
"numExp : '-' numExp",
"numExp : numExp '*' numExp",
"numExp : numExp '/' numExp",
"numExp : numExp '^' numExp",
"numExp : '(' numExp ')'",
};

//#line 437 "matlabMe.y"
  private int c_row;
  private int c_col;
  private int c_matrix;
  private Matrix tempMatrix;
  private Yylex lexer;
  private ByteArrayOutputStream byteArrayWriter;
  private Writer writer;
  private Variables variables;
  
  private int yylex () {
    int yyl_return = -1;
    try {
      yylval = new ParserVal(0);
      yyl_return = lexer.yylex();
    }
    catch (IOException e) {
        System.out.println("IO error :" + e);
    }
    return yyl_return;
  }

  public void addToWriter (String s) {
    if(this.yydebug!=true) {
        try {
            writer.write(s, 0, s.length());
        } catch (IOException e) {
            System.out.println("IO error :" + e);
        }
     } else {
        System.out.print(s);
     }
  }
  
  public void yyerror (String error) {
    String s=null;
    if (this.yychar <= YYMAXTOKEN) //check index bounds
        s = this.yyname[this.yychar];    //now get it
    if (s==null)
        s = "illegal-symbol";
    if(error.equalsIgnoreCase("stack underflow. aborting..."))
        addToWriter("Parser error at line "+(lexer.getLineNumber()+1)+ ", char "+(lexer.getCharNumber()+1)+ ".\nUnexpected token: "+s+" ("+lexer.getLastToken()+")\n");
  }

  public Parser(Reader r) {
    lexer = new Yylex(r, this);
    c_row=0;
    c_col=0;
    c_matrix=0;
    tempMatrix = new Matrix (1, 1);
    byteArrayWriter=new ByteArrayOutputStream();
    writer=new OutputStreamWriter(byteArrayWriter);
    variables = new Variables();
    //this.yydebug=true;
  }

  
  public void parse() {
    this.yyparse();
  }
  
  public String getOutput() {
    return byteArrayWriter.toString();
  }
  
  public Variables getVariables() {
    return this.variables;
  }
  
  /*public static void main(String args[]) throws IOException {
    System.out.println("matlabMe cmd line version");

      Parser yyparser;

      System.out.println("[Quit with CTRL-D]");
      System.out.print("Expression: ");
      yyparser = new Parser(new InputStreamReader(System.in));
      yyparser.yyparse();
   
  }*/
//#line 531 "Parser.java"
//###############################################################
// method: yylexdebug : check lexer state
//###############################################################
void yylexdebug(int state,int ch)
{
String s=null;
  if (ch < 0) ch=0;
  if (ch <= YYMAXTOKEN) //check index bounds
     s = yyname[ch];    //now get it
  if (s==null)
    s = "illegal-symbol";
  debug("state "+state+", reading "+ch+" ("+s+")");
}





//The following are now global, to aid in error reporting
int yyn;       //next next thing to do
int yym;       //
int yystate;   //current parsing state from state table
String yys;    //current token string


//###############################################################
// method: yyparse : parse input and execute indicated items
//###############################################################
int yyparse()
{
boolean doaction;
  init_stacks();
  yynerrs = 0;
  yyerrflag = 0;
  yychar = -1;          //impossible char forces a read
  yystate=0;            //initial state
  state_push(yystate);  //save it
  val_push(yylval);     //save empty value
  while (true) //until parsing is done, either correctly, or w/error
    {
    doaction=true;
    if (yydebug) debug("loop"); 
    //#### NEXT ACTION (from reduction table)
    for (yyn=yydefred[yystate];yyn==0;yyn=yydefred[yystate])
      {
      if (yydebug) debug("yyn:"+yyn+"  state:"+yystate+"  yychar:"+yychar);
      if (yychar < 0)      //we want a char?
        {
        yychar = yylex();  //get next token
        if (yydebug) debug(" next yychar:"+yychar);
        //#### ERROR CHECK ####
        if (yychar < 0)    //it it didn't work/error
          {
          yychar = 0;      //change it to default string (no -1!)
          if (yydebug)
            yylexdebug(yystate,yychar);
          }
        }//yychar<0
      yyn = yysindex[yystate];  //get amount to shift by (shift index)
      if ((yyn != 0) && (yyn += yychar) >= 0 &&
          yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
        {
        if (yydebug)
          debug("state "+yystate+", shifting to state "+yytable[yyn]);
        //#### NEXT STATE ####
        yystate = yytable[yyn];//we are in a new state
        state_push(yystate);   //save it
        val_push(yylval);      //push our lval as the input for next rule
        yychar = -1;           //since we have 'eaten' a token, say we need another
        if (yyerrflag > 0)     //have we recovered an error?
           --yyerrflag;        //give ourselves credit
        doaction=false;        //but don't process yet
        break;   //quit the yyn=0 loop
        }

    yyn = yyrindex[yystate];  //reduce
    if ((yyn !=0 ) && (yyn += yychar) >= 0 &&
            yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
      {   //we reduced!
      if (yydebug) debug("reduce");
      yyn = yytable[yyn];
      doaction=true; //get ready to execute
      break;         //drop down to actions
      }
    else //ERROR RECOVERY
      {
      if (yyerrflag==0)
        {
        yyerror("syntax error");
        yynerrs++;
        }
      if (yyerrflag < 3) //low error count?
        {
        yyerrflag = 3;
        while (true)   //do until break
          {
          if (stateptr<0)   //check for under & overflow here
            {
            yyerror("stack underflow. aborting...");  //note lower case 's'
            return 1;
            }
          yyn = yysindex[state_peek(0)];
          if ((yyn != 0) && (yyn += YYERRCODE) >= 0 &&
                    yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
            {
            if (yydebug)
              debug("state "+state_peek(0)+", error recovery shifting to state "+yytable[yyn]+" ");
            yystate = yytable[yyn];
            state_push(yystate);
            val_push(yylval);
            doaction=false;
            break;
            }
          else
            {
            if (yydebug)
              debug("error recovery discarding state "+state_peek(0)+" ");
            if (stateptr<0)   //check for under & overflow here
              {
              yyerror("Stack underflow. aborting...");  //capital 'S'
              return 1;
              }
            state_pop();
            val_pop();
            }
          }
        }
      else            //discard this token
        {
        if (yychar == 0)
          return 1; //yyabort
        if (yydebug)
          {
          yys = null;
          if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
          if (yys == null) yys = "illegal-symbol";
          debug("state "+yystate+", error recovery discards token "+yychar+" ("+yys+")");
          }
        yychar = -1;  //read another
        }
      }//end error recovery
    }//yyn=0 loop
    if (!doaction)   //any reason not to proceed?
      continue;      //skip action
    yym = yylen[yyn];          //get count of terminals on rhs
    if (yydebug)
      debug("state "+yystate+", reducing "+yym+" by rule "+yyn+" ("+yyrule[yyn]+")");
    if (yym>0)                 //if count of rhs not 'nil'
      yyval = val_peek(yym-1); //get current semantic value
    yyval = dup_yyval(yyval); //duplicate yyval if ParserVal is used as semantic value
    switch(yyn)
      {
//########## USER-SUPPLIED ACTIONS ##########
case 3:
//#line 40 "matlabMe.y"
{ }
break;
case 4:
//#line 43 "matlabMe.y"
{ }
break;
case 5:
//#line 46 "matlabMe.y"
{ }
break;
case 6:
//#line 49 "matlabMe.y"
{ 
             /*supress output - semicolon... do nothing :)*/
       }
break;
case 7:
//#line 54 "matlabMe.y"
{ 
             addToWriter(("ans = " + val_peek(1).obj.toString() + "\n")); 
       }
break;
case 8:
//#line 59 "matlabMe.y"
{ 
             /*supress output - semicolon... do nothing :)*/
       }
break;
case 9:
//#line 64 "matlabMe.y"
{
             addToWriter(("ans = " + val_peek(1).dval + "\n")); 
       }
break;
case 10:
//#line 69 "matlabMe.y"
{
             Object obj = null;
             try {
                obj = variables.get(val_peek(1).sval.toUpperCase());
             } catch (Exception e) {
                addToWriter(e.getMessage()); /*there is no such variable*/
                return -1;
             }
             addToWriter((val_peek(1).sval.toUpperCase()+" = " + obj.toString() + "\n"));
       }
break;
case 11:
//#line 81 "matlabMe.y"
{
            /*supress output - semicolon... but save as a variable*/
            variables.add((Matrix)val_peek(2).obj, val_peek(4).sval.toUpperCase());
       }
break;
case 12:
//#line 87 "matlabMe.y"
{
            /*display results, and save as a variable*/
            variables.add((Matrix)val_peek(1).obj, val_peek(3).sval.toUpperCase());
            addToWriter((val_peek(3).sval.toUpperCase()+" = " + val_peek(1).obj.toString() + "\n"));             
       }
break;
case 13:
//#line 94 "matlabMe.y"
{
            /*no support for numExp variables... don't have idea how to implement this feature*/
            addToWriter("Sorry, but there no support for numeric variables...\n");
       }
break;
case 14:
//#line 100 "matlabMe.y"
{
            /*no support for numExp variables... don't have idea how to implement this feature*/
            addToWriter("Sorry, but there no support for numeric variables...\n");
       }
break;
case 15:
//#line 108 "matlabMe.y"
{
            yyval.obj = val_peek(0).obj;
       }
break;
case 16:
//#line 113 "matlabMe.y"
{
            Object obj = null;
            try {
                obj = variables.get(val_peek(0).sval.toUpperCase());
            } catch (Exception e) {
                addToWriter(e.getMessage()); /*there is no such variable*/
                return -1;
            }
            yyval.obj=(Matrix)obj;
       }
break;
case 17:
//#line 125 "matlabMe.y"
{
            yyval.obj = val_peek(1).obj;
       }
break;
case 18:
//#line 130 "matlabMe.y"
{
            tempMatrix=(Matrix)val_peek(1).obj;
            yyval.obj = new Double(tempMatrix.determinant());
       }
break;
case 19:
//#line 136 "matlabMe.y"
{
            tempMatrix=(Matrix)val_peek(1).obj;
            tempMatrix=tempMatrix.transpose();
            yyval.obj = (Matrix)tempMatrix;
       }
break;
case 20:
//#line 143 "matlabMe.y"
{
            tempMatrix=(Matrix)val_peek(2).obj;
            double exp = val_peek(0).dval;
            if(exp < 0) {
                try {
                    tempMatrix=tempMatrix.inverse();
                }  catch (Exception e) {
                        addToWriter("Error while inversing matrix: "+e.getMessage()+"!\n");
                        return -1;
                }
                Matrix tmp = new Matrix(tempMatrix);
                try {
                    for (int i=0;i<(int)(exp*-1-1);i++) {
                        tempMatrix=tempMatrix.mult(tmp);
                    }
                } catch (MatrixDimensionError e) {
                    addToWriter("Matrix dimension error 1st ("+tempMatrix.rows()+", "+tempMatrix.cols()+"), 2d ("+tempMatrix.rows()+", "+tempMatrix.cols()+")!\n");
                    return -1;
                }
            }
            else if (exp == 0) {
                int i = tempMatrix.rows();
                tempMatrix=new Matrix(i);
            }
            else {
                tempMatrix=(Matrix)val_peek(2).obj;
                Matrix tmp = new Matrix(tempMatrix);
                try {
                    for (int i=0;i<(int)exp-1;i++) {
                        tempMatrix=tempMatrix.mult(tmp);
                    }
                } catch (MatrixDimensionError e) {
                    addToWriter("Matrix dimension error 1st ("+tempMatrix.rows()+", "+tempMatrix.cols()+"), 2d ("+tempMatrix.rows()+", "+tempMatrix.cols()+")!\n");
                    return -1;
                }
            }
            yyval.obj = (Matrix)tempMatrix;

       }
break;
case 21:
//#line 184 "matlabMe.y"
{
            tempMatrix=(Matrix)val_peek(2).obj;
            tempMatrix.selfExp(val_peek(0).dval);
            yyval.obj=tempMatrix;
       }
break;
case 22:
//#line 191 "matlabMe.y"
{
           try {
                tempMatrix=(Matrix)val_peek(2).obj;
                tempMatrix=tempMatrix.add((Matrix)val_peek(0).obj);
                yyval.obj = (Matrix)tempMatrix;
           }
           catch (MatrixDimensionError e) {
                Matrix tempMatrix1 = new Matrix((Matrix)val_peek(2).obj);
                Matrix tempMatrix2 = new Matrix((Matrix)val_peek(0).obj);
                addToWriter("Matrix dimension error 1st ("+tempMatrix1.rows()+", "+tempMatrix1.cols()+"), 2d ("+tempMatrix2.rows()+", "+tempMatrix2.cols()+")!\n");
                return -1;
           }
       }
break;
case 23:
//#line 206 "matlabMe.y"
{
           tempMatrix=(Matrix)val_peek(2).obj;
           tempMatrix.selfAdd((double)val_peek(0).dval);
           yyval.obj = (Matrix)tempMatrix;
       }
break;
case 24:
//#line 213 "matlabMe.y"
{
           tempMatrix=(Matrix)val_peek(0).obj;
           tempMatrix.selfAdd((double)val_peek(2).dval);
           yyval.obj = (Matrix)tempMatrix;
       }
break;
case 25:
//#line 220 "matlabMe.y"
{
           tempMatrix=(Matrix)val_peek(2).obj;
           tempMatrix.selfAdd((double)val_peek(0).dval);
           yyval.obj = (Matrix)tempMatrix;
       }
break;
case 26:
//#line 227 "matlabMe.y"
{
           tempMatrix=(Matrix)val_peek(0).obj;
           tempMatrix.selfAdd((double)val_peek(2).dval);
           yyval.obj = (Matrix)tempMatrix;
       }
break;
case 27:
//#line 235 "matlabMe.y"
{
           try {
                tempMatrix=(Matrix)val_peek(2).obj;
                tempMatrix=tempMatrix.add((Matrix)val_peek(0).obj);
                yyval.obj = (Matrix)tempMatrix;
           }
           catch (MatrixDimensionError e) {
                Matrix tempMatrix1 = new Matrix((Matrix)val_peek(2).obj);
                Matrix tempMatrix2 = new Matrix((Matrix)val_peek(0).obj);
                addToWriter("Matrix dimension error 1st ("+tempMatrix1.rows()+", "+tempMatrix1.cols()+"), 2d ("+tempMatrix2.rows()+", "+tempMatrix2.cols()+")!\n");
                return -1;
           }
       }
break;
case 28:
//#line 250 "matlabMe.y"
{
           tempMatrix=(Matrix)val_peek(2).obj;
           tempMatrix.selfAdd((double)-1*val_peek(0).dval);
           yyval.obj = (Matrix)tempMatrix;
       }
break;
case 29:
//#line 257 "matlabMe.y"
{
           tempMatrix=(Matrix)val_peek(0).obj;
           tempMatrix.selfAdd((double)-1*val_peek(2).dval);
           yyval.obj = (Matrix)tempMatrix;
       }
break;
case 30:
//#line 264 "matlabMe.y"
{
           tempMatrix=(Matrix)val_peek(2).obj;
           tempMatrix.selfAdd((double)-1*val_peek(0).dval);
           yyval.obj = (Matrix)tempMatrix;
       }
break;
case 31:
//#line 271 "matlabMe.y"
{
           tempMatrix=(Matrix)val_peek(0).obj;
           tempMatrix.selfAdd((double)-1*val_peek(2).dval);
           yyval.obj = (Matrix)tempMatrix;
       }
break;
case 32:
//#line 278 "matlabMe.y"
{
            try {
                tempMatrix=(Matrix)val_peek(2).obj;
                tempMatrix=tempMatrix.mult((Matrix)val_peek(0).obj);
                yyval.obj = (Matrix)tempMatrix;
            } catch (MatrixDimensionError e) {
                Matrix tempMatrix1 = new Matrix((Matrix)val_peek(2).obj);
                Matrix tempMatrix2 = new Matrix((Matrix)val_peek(0).obj);
                addToWriter("Matrix dimension error 1st ("+tempMatrix1.rows()+", "+tempMatrix1.cols()+"), 2d ("+tempMatrix2.rows()+", "+tempMatrix2.cols()+")!\n");
                return -1;
            }
       }
break;
case 33:
//#line 292 "matlabMe.y"
{
           tempMatrix=(Matrix)val_peek(2).obj;
           tempMatrix.selfMult((double)val_peek(0).dval);
           yyval.obj = (Matrix)tempMatrix;
       }
break;
case 34:
//#line 299 "matlabMe.y"
{
           tempMatrix=(Matrix)val_peek(0).obj;
           tempMatrix.selfMult((double)val_peek(2).dval);
           yyval.obj = (Matrix)tempMatrix;
       }
break;
case 35:
//#line 306 "matlabMe.y"
{
           tempMatrix=(Matrix)val_peek(2).obj;
           tempMatrix.selfMult((double)val_peek(0).dval);
           yyval.obj = (Matrix)tempMatrix;
       }
break;
case 36:
//#line 313 "matlabMe.y"
{
           tempMatrix=(Matrix)val_peek(0).obj;
           tempMatrix.selfMult((double)val_peek(2).dval);
           yyval.obj = (Matrix)tempMatrix;
       }
break;
case 37:
//#line 320 "matlabMe.y"
{
            try {
                Matrix tempMatrix1=(Matrix)val_peek(0).obj;
                tempMatrix=(Matrix)val_peek(2).obj;
                try {
                    tempMatrix=tempMatrix.mult(tempMatrix1.inverse());
                    yyval.obj = (Matrix)tempMatrix;
                } catch (Exception e) {
                    addToWriter("Error while inversing matrix: "+e.getMessage()+"!\n");
                    return -1;
                }
            } catch (MatrixDimensionError e) {
                Matrix tempMatrix1 = new Matrix((Matrix)val_peek(2).obj);
                Matrix tempMatrix2 = new Matrix((Matrix)val_peek(0).obj);
                addToWriter("Matrix dimension error, 1st matrix ("+tempMatrix1.rows()+", "+tempMatrix1.cols()+"), 2d  matrix ("+tempMatrix2.rows()+", "+tempMatrix2.cols()+")!\n");
                return -1;
            }
       }
break;
case 38:
//#line 340 "matlabMe.y"
{
           tempMatrix=(Matrix)val_peek(2).obj;
           tempMatrix.selfDiv((double)val_peek(0).dval);
           yyval.obj = (Matrix)tempMatrix;
       }
break;
case 39:
//#line 347 "matlabMe.y"
{
           tempMatrix=(Matrix)val_peek(0).obj;
           tempMatrix.selfDiv((double)val_peek(2).dval);
           yyval.obj = (Matrix)tempMatrix;
       }
break;
case 40:
//#line 354 "matlabMe.y"
{
           tempMatrix=(Matrix)val_peek(2).obj;
           tempMatrix.selfDiv((double)val_peek(0).dval);
           yyval.obj = (Matrix)tempMatrix;
       }
break;
case 41:
//#line 361 "matlabMe.y"
{
           tempMatrix=(Matrix)val_peek(0).obj;
           tempMatrix.selfDiv((double)val_peek(2).dval);
           yyval.obj = (Matrix)tempMatrix;
       }
break;
case 42:
//#line 369 "matlabMe.y"
{
           tempMatrix=new Matrix(1,1);
       }
break;
case 43:
//#line 373 "matlabMe.y"
{
           c_col=0;
           c_row=0;
           yyval.obj = (Matrix)tempMatrix;
       }
break;
case 44:
//#line 382 "matlabMe.y"
{
        c_col=0;
        c_row++;
    }
break;
case 45:
//#line 387 "matlabMe.y"
{
        c_col=0;
        c_row++;
    }
break;
case 46:
//#line 395 "matlabMe.y"
{
            for (double i=val_peek(2).dval;i<val_peek(0).dval;i++) {
                tempMatrix.setCell(c_row, c_col, i);
                c_col++;
            }
            c_col++;
        }
break;
case 47:
//#line 404 "matlabMe.y"
{
            for (double i=val_peek(4).dval;i<val_peek(0).dval;i+=val_peek(2).dval) {
                tempMatrix.setCell(c_row, c_col, i);
                c_col++;
            }
            c_col++;
        }
break;
case 48:
//#line 413 "matlabMe.y"
{
            tempMatrix.setCell(c_row, c_col, val_peek(0).dval);
            c_col++;
        }
break;
case 49:
//#line 419 "matlabMe.y"
{
            tempMatrix.setCell(c_row, c_col, val_peek(0).dval);
            c_col++;
        }
break;
case 50:
//#line 425 "matlabMe.y"
{  yyval.dval=val_peek(0).dval; }
break;
case 51:
//#line 426 "matlabMe.y"
{ yyval.dval = val_peek(2).dval + val_peek(0).dval; }
break;
case 52:
//#line 427 "matlabMe.y"
{ yyval.dval = val_peek(2).dval - val_peek(0).dval; }
break;
case 53:
//#line 428 "matlabMe.y"
{ yyval.dval = val_peek(0).dval; }
break;
case 54:
//#line 429 "matlabMe.y"
{ yyval.dval = -val_peek(0).dval; }
break;
case 55:
//#line 430 "matlabMe.y"
{ yyval.dval = val_peek(2).dval * val_peek(0).dval; }
break;
case 56:
//#line 431 "matlabMe.y"
{ yyval.dval = val_peek(2).dval / val_peek(0).dval; }
break;
case 57:
//#line 432 "matlabMe.y"
{ yyval.dval = myjava.Math.pow(val_peek(2).dval, val_peek(0).dval); }
break;
case 58:
//#line 433 "matlabMe.y"
{ yyval.dval = val_peek(1).dval; }
break;
//#line 1142 "Parser.java"
//########## END OF USER-SUPPLIED ACTIONS ##########
    }//switch
    //#### Now let's reduce... ####
    if (yydebug) debug("reduce");
    state_drop(yym);             //we just reduced yylen states
    yystate = state_peek(0);     //get new state
    val_drop(yym);               //corresponding value drop
    yym = yylhs[yyn];            //select next TERMINAL(on lhs)
    if (yystate == 0 && yym == 0)//done? 'rest' state and at first TERMINAL
      {
      if (yydebug) debug("After reduction, shifting from state 0 to state "+YYFINAL+"");
      yystate = YYFINAL;         //explicitly say we're done
      state_push(YYFINAL);       //and save it
      val_push(yyval);           //also save the semantic value of parsing
      if (yychar < 0)            //we want another character?
        {
        yychar = yylex();        //get next character
        if (yychar<0) yychar=0;  //clean, if necessary
        if (yydebug)
          yylexdebug(yystate,yychar);
        }
      if (yychar == 0)          //Good exit (if lex returns 0 ;-)
         break;                 //quit the loop--all DONE
      }//if yystate
    else                        //else not done yet
      {                         //get next state and push, for next yydefred[]
      yyn = yygindex[yym];      //find out where to go
      if ((yyn != 0) && (yyn += yystate) >= 0 &&
            yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
        yystate = yytable[yyn]; //get new state
      else
        yystate = yydgoto[yym]; //else go to new defred
      if (yydebug) debug("after reduction, shifting from state "+state_peek(0)+" to state "+yystate+"");
      state_push(yystate);     //going again, so push state & val...
      val_push(yyval);         //for next action
      }
    }//main loop
  return 0;//yyaccept!!
}
//## end of method parse() ######################################



//## run() --- for Thread #######################################
/**
 * A default run method, used for operating this parser
 * object in the background.  It is intended for extending Thread
 * or implementing Runnable.  Turn off with -Jnorun .
 */
public void run()
{
  yyparse();
}
//## end of method run() ########################################



//## Constructors ###############################################
/**
 * Default constructor.  Turn off with -Jnoconstruct .

 */
public Parser()
{
  //nothing to do
}


/**
 * Create a parser, setting the debug to true or false.
 * @param debugMe true for debugging, false for no debug.
 */
public Parser(boolean debugMe)
{
  yydebug=debugMe;
}
//###############################################################



}
//################### END OF CLASS ##############################
